Hệ thống quản lý thanh toán POS nhà hàng

1 Imports System.Data.OleDb
2 Public Class frmLock
3     Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
4         If Len(Trim(UserID.Text)) =
0 Then
5             MessageBox.Show(
"Please enter user id", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
6             UserID.Focus()
7             Exit Sub
8         End If
9         If Len(Trim(Password.Text)) =
0 Then
10             MessageBox.Show(
"Please enter password", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
11             Password.Focus()
12             Exit Sub
13         End If
14         Try
15             con = New OleDbConnection(cs)
16             con.Open()
17             cmd = con.CreateCommand()
18             cmd.CommandText =
"SELECT RTRIM(UserID),RTRIM([Password]) FROM Registration where UserID = @d1 and [Password]=@d2 and Active='Yes'"
19             cmd.Parameters.AddWithValue(
"@d1", UserID.Text)
20             cmd.Parameters.AddWithValue(
"@d2", Encrypt(Password.Text))
21             rdr = cmd.ExecuteReader()
22             If rdr.Read() Then
23                 Me.Hide()
24                 frmBillling.lblUser.Text = UserID.Text
25                 frmBillling.Show()
26             Else
27                 MsgBox(
"Invalid Password...Try again !", MsgBoxStyle.Critical, "Login Denied")
28                 Password.Text =
""
29                 Password.Focus()
30             End If
31             cmd.Dispose()
32             con.Close()
33         Catch ex As Exception
34             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
35         End Try
36     End Sub
37 End Class


Gõ tìm kiếm nhanh...